package com.kingmed.kmss.admin.modules.sys.mapper;

import com.kingmed.kmss.admin.modules.sys.model.SysSequence;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * <p>
 * 流水号 Mapper 接口
 * </p>
 *
 * @author liangzhi
 * @since 2023-06-08
 */
public interface SysSequenceMapper extends BaseMapper<SysSequence> {

    @Update("update sys_sequence set seq_num = #{seq.seqNum} + #{step} where id = #{seq.id} and seq_num = #{seq.seqNum}")
    int incrementSeq(@Param("seq") SysSequence sequence, @Param("step") Integer step);
}
